package service.impl;

import dao.PatientDao;
import entity.Patient;
import org.springframework.stereotype.Service;
import service.CustomerService;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;



@Service("customerService")
public class CustomerServiceImpl implements CustomerService {

    @Resource(name = "patientDao")
    PatientDao patientDao;

    @Override
    public Map<String,Object> QuerAll(String Name, String Sex, int pageSize, int pageNumber) {
        Map<String,Object> map=new HashMap<String, Object>();
        map.put("name",Name);
        map.put("sex",Sex);
        map.put("offset",(pageNumber-1)*pageSize);
        map.put("limit",pageSize);
        Map<String,Object> map1=new HashMap<String, Object>();
        map1.put("rows",patientDao.QueryAll(map));
        map1.put("total",patientDao.QueryAllCount(map));
        return map1 ;
    }

    @Override
    public boolean Update(Patient patient) {
        return patientDao.Update(patient)>0;
    }

    @Override
    public boolean del(int pid) {
        return patientDao.del(pid)>0;
    }
}
